package cn.edu.zust.se.api.clients;

import cn.edu.zust.se.api.common.R;
import cn.edu.zust.se.api.entity.File;
import cn.edu.zust.se.api.entity.Folder;
import cn.edu.zust.se.api.entity.bo.FileBo;
import cn.edu.zust.se.api.entity.bo.FolderBo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "file-service")
public interface FileClient {
    //获取当前文件夹下的所有文件
    @GetMapping("/file/getFilesByFolderId/{folderId}/{type}")
    List<File> getFilesByFolderId(@PathVariable Long folderId, @PathVariable Integer type);

    @GetMapping("/folder/getFoldersByFolderId/{folderId}/{type}")
    List<Folder> getFoldersByFolderId(@PathVariable Long folderId, @PathVariable Integer type);

    //新增文件夹(只需要文件价名字 上层目录id)
    @PostMapping("/folder/addFolder")
    R<Boolean> addFolder(@RequestBody FolderBo folderBo);

    //文件查询
    @GetMapping("/file/getFileById/{fileId}")
    R<File> getFileById(@PathVariable Long fileId);

    //文件更新
    @PutMapping("/file/updateFile")
    R<Void> updateFile(@RequestBody FileBo fileBo);
    //获取用户的根目录文件id
    @GetMapping("/file/getRootFolderId/{userId}")
    R<Long> getRootFolderId(@PathVariable Long userId);



}
